package com.tp7567.domain;

import java.util.List;
import com.google.common.collect.Lists;
import com.tp7567.domain.Patient.PG;
import com.tp7567.domain.Patient.SA;
import com.tp7567.domain.Patient.SB;
import com.tp7567.domain.Patient.SC;
import com.tp7567.domain.Patient.SD;
import com.tp7567.domain.Patient.SE;
import com.tp7567.domain.Patient.SF;
import com.tp7567.domain.Patient.SG;
import com.tp7567.domain.Patient.SH;
import com.tp7567.domain.Patient.SI;
import com.tp7567.domain.Patient.SJ;
import com.tp7567.domain.Patient.SK;
import com.tp7567.domain.Patient.SL;
import com.tp7567.domain.Patient.SM;
import com.tp7567.domain.Patient.SN;
import com.tp7567.domain.Patient.SO;
import com.tp7567.domain.Patient.SP;

/**
 * 
 * @author Maxi Rosson
 */
public enum AutismLevel {
	
	NONE("none", "No presenta sintomas de autismo", Lists.<AutismLevelDescription>newArrayList()),
	
	AUTISMO("DTAU", "Autismo", Lists.<AutismLevelDescription>newArrayList(desc(SA.SAA), desc(SB.SBPFUYFO, SB.SBSL),
		desc(SC.SCME, SC.SCMU), desc(SD.SDS), desc(SE.SE_50, SE.SE50_70), desc(SF.SFS), desc(SH.SHME), desc(SI.SI3_5),
		desc(SJ.SJDL, SJ.SJGD), desc(SL.SLS), desc(SM.SMA, SM.SML), desc(SO.SOS))),
	
	DESINTEGRATIVO("DTRE", "Trastorno de Rett", Lists.<AutismLevelDescription>newArrayList(desc(PG.PGF), desc(SA.SAA),
		desc(SB.SBSL, SB.SBPFUYFO), desc(SC.SCMU), desc(SD.SDS), desc(SE.SE_50), desc(SF.SFS), desc(SG.SGS),
		desc(SH.SHPO), desc(SI.SI_3), desc(SJ.SJGD), desc(SK.SKN), desc(SL.SLS), desc(SM.SMA), desc(SN.SNN),
		desc(SO.SOS), desc(SP.SPS))),
	
	RETT("DTDE", "Trastorno desintegrativo infantil", Lists.<AutismLevelDescription>newArrayList(desc(SA.SAA),
		desc(SB.SBPFUYFO, SB.SBSL), desc(SC.SCMU), desc(SD.SDS), desc(SE.SE_50, SE.SE50_70), desc(SF.SFS),
		desc(SG.SGN), desc(SH.SHMU), desc(SI.SI5_10), desc(SJ.SJDL), desc(SK.SKS), desc(SL.SLS), desc(SM.SML),
		desc(SN.SNN), desc(SO.SOS))),
	
	ASPERGER("DTAS", "Trastorno de Asperger", Lists.<AutismLevelDescription>newArrayList(desc(SA.SAL), desc(SB.SBPFU),
		desc(SC.SCPO, SC.SCME), desc(SD.SDS), desc(SE.SE_70), desc(SF.SFS), desc(SG.SGN), desc(SH.SHNO),
		desc(SI.SI3_5), desc(SJ.SJSD), desc(SK.SKS), desc(SL.SLS), desc(SM.SML, SM.SMN), desc(SP.SPN))),
	
	GENERALIZADO("DTNE", "Trastorno generalizado del desarrollo no especificado",
			Lists.<AutismLevelDescription>newArrayList(desc(SA.SAL, SA.SAA), desc(SB.SBPFUYFO, SB.SBPFU),
				desc(SC.SCME, SC.SCMU), desc(SD.SDS), desc(SE.SE_50, SE.SE50_70), desc(SF.SFS), desc(SG.SGN),
				desc(SH.SHME), desc(SI.SI3_5, SI.SI5_10), desc(SJ.SJSD, SJ.SJDL), desc(SK.SKS), desc(SL.SLS),
				desc(SM.SML, SM.SMN), desc(SP.SPN)));
	
	private String levelKey;
	private String name;
	private List<AutismLevelDescription> autismLevelDescriptions;
	
	private static AutismLevelDescription desc(Sintoma... sintomas) {
		return new AutismLevelDescription(sintomas[0].getType(), sintomas);
	}
	
	private AutismLevel(String levelKey, String name, List<AutismLevelDescription> autismLevelDescriptions) {
		this.levelKey = levelKey;
		this.name = name;
		this.autismLevelDescriptions = autismLevelDescriptions;
	}
	
	public static AutismLevel findByLevelKey(String levelKey) {
		for (AutismLevel type : values()) {
			if (type.levelKey.equalsIgnoreCase(levelKey)) {
				return type;
			}
		}
		return null;
	}
	
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * @return the sintomas
	 */
	public List<AutismLevelDescription> getAutismLevelDescriptions() {
		return autismLevelDescriptions;
	}
	
}
